<?php

namespace Database\Seeders;

use App\Models\GoldProduct;
use App\Models\GoldRound;
use App\Models\GoldSeed;
use App\Models\Group;
use App\Models\Product;
use App\Models\ProductSku;
use App\Models\ProductImage;
use App\Models\ProductSlide;
use Carbon\Carbon;
use Illuminate\Database\Seeder;

class ProductSeeder extends Seeder
{
    public function run()
    {
    	
        $products = Product::factory()->count(10)->create();
        foreach ($products as $product) {
        	$skus = ProductSku::factory()->count(3)->create(['product_id' => $product->id]);
        	$product->update(['price_lowest' => $skus->min('price')]);
        	$product->update(['price_market' => $skus->max('price')]);
        	
        	ProductSlide::factory()->count(3)->create(['product_id' => $product->id]);
        	ProductImage::factory()->count(3)->create(['product_id' => $product->id]);
        }
        
       
    }
}
